using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Linq;
using B.S.Medical.Domain.Medical;
using B.S.Medical.Infrastructure;

namespace B.S.Medical.Api.Write.Controllers.Register
{
    [ApiController]
    [Route("api/[controller]/[action]")]
    public class RegisterDetailController : ControllerBase
    {
        private readonly MyDbContext _db;
        public RegisterDetailController(MyDbContext db)
        {
            _db = db;
        }

        /// <summary>
        /// 根据挂号单ID查询明细列表
        /// </summary>
        [HttpGet]
        public ActionResult<List<RegisterDetailModel>> GetByRegisterId(int registerId)
        {
            var list = _db.Set<RegisterDetailModel>()
                .Where(d => d.RegisterId == registerId)
                .OrderBy(d => d.Id)
                .ToList();
            return Ok(list);
        }
    }
} 